/******************************************************************************

	filename :  TileContentCreator.fx
	version  :  0.1
	author   :  Bernardo Z. Cinco Jr.
	date     :  July 19, 2010   
	
	Description:
	 > Given a tile type (number), returns corresponding array of contents.
		
    Version History:
     > 0.2 == 8/30/10
           -- Properly fields for for "Increase _ by _"
           -- Supports arrAllowedTypes bool array, which must be manually
           	  encoded for all expected tile types.
     > 0.1 == 7/19/10
           -- start

******************************************************************************/

package mythesis.controller;
import mythesis.gui.tile.TileField;
import javafx.scene.text.Text;
import javafx.scene.paint.Color;

public class TileContentCreator
{
    var arrTileField:TileField[];
    var numCountOfFieldItems:Number = 0;
    var numIndentX:Number = 35;

    
    function addText(text:String, x:Number)
    {
        var tf = TileField
        {
            booIsButton: false;
            strLabel   : text;
            translateX : numIndentX + x;
        }
        insert tf into arrTileField;
    }
    
    function addButton(text:String, x:Number, arrAllowedTypes:Boolean[])
    {
        var tf = TileField
        {
            booIsButton     : true;
            strLabel        : text;
            arrAllowedTypes : arrAllowedTypes;
            translateX      : numIndentX + x;
            translateY      : -15;
        }
        insert tf into arrTileField;
    }
    
    public function getContent(type:Number):TileField[]
    {
        if (type == 0)
        {
            addText("Roll dice", 0);
        }
        else if (type == 1)
        {
            addText("Increase ", 0);
            addButton("variable", 15, [false, false, false,						// Variable integer only
            						   false, true, false,
            						   false, false, false,
            						   false, false, false,
            						   false, false, false] );
            
            addText("by", 125);
            addButton("variable", 110,[false, true, false,						// All integers
                                       false, true, false,
                                       false, true, false,
                                       false, true, false,
                                       false, true, false]);
        }
        return arrTileField; 
    }
}